<!DOCTYPE html>
<?php

require_once ('conn.php');
require_once ('top.php');
if($_SESSION['role']==1){
      Header("Location:index.php"); 
    }elseif($_SESSION['role']==3){
           Header("Location:dotlistMaster.php"); 
   }
?>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>优易购</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <script src="js/jquery-1.11.0.min.js"></script>
    <script type="text/javascript">
function showTime(){
    nowtime=new Date();
    year=nowtime.getFullYear();
    month=nowtime.getMonth()+1;
    date=nowtime.getDate();
    document.getElementById("mytime").innerText=year+"年"+month+"月"+date+" "+nowtime.toLocaleTimeString();
}

setInterval("showTime()");

</script>
</head>
<body>
    <div class="top">
        <span>补货专员 - 首页</span>
        <div class="tright"><span class="outlogin">退出登陆</span></div>
    </div>
    <div class="time" id="mytime"></div>
    
    
    
     <?php

    $result=mysql_query("select * from ci_invoice where transType = 150601 and billType='SALE' and isDelete=0 and hxStateCode=1 and bhstaffid =".$_SESSION['userid']  ); 
    $i=0;
    $Total;//总库存
    $Surplus;//当前库存
    $num;//交易额
    $but;//是否显示补货按钮
    
    while($row=mysql_fetch_array($result))
        
    { 
    
    $ci_contact = mysql_fetch_row(mysql_query("select name,number,id from ci_contact where id=".$row['buId']));//获得网点编号
    ?>
    
    
    <div onclick="window.open('supply_info.php?id=<?=$row['id']?>','_self')" class="list" id="list<?=$row['id']?>">
        <p>网点名称：<?=$ci_contact[0]?></p>
        
        <div class="supplydingwei">
                <img src="img/dingwei.png" alt="">
                <span>导航到此</span>
                <div class="addno" onclick="buhuo(<?=$row['id']?>);(function(e){
    var e = window.event || e;
    if (e.stopPropagation) e.stopPropagation();
    else e.cancelBubble = true;
})(event)">补货</div>
                
            </div>
    </div>
    <?php  $i++; }?>
    
    
    <div style=" width:100%;height:100px; float:left;"></div>
    <div class="supplyfootbut"><img src="img/i.png" alt="">当前有<span class="shuzi"><?=$i?></span>网点仍未补货</div>
    <div class="foot">
        <a href="supply_index.php">
        <div>
        <img src="img/f11.png" alt="">
        <p>首页</p>
        </div>
        </a>
        <a href="supply_pandian.php">
        <div>
        <img src="img/f22.png" alt="">
        <p>网点</p>
        </div>
        </a>
        
        
        <div  class="footon">
        <img src="img/f3.png" alt="">
        <p>补货</p>
        </div>
        
    </div>
</body>
<script>
function buhuo(id){
         if(!confirm("是否确认补货？")){ 
 return false; 
} 
 $.post("ajaxbuhuook.php",{id:id},function(data) {
  if(data=="y"){
      $("#list"+id).hide();
      var shuzi = $(".shuzi").html() - 1;
      $(".shuzi").html(shuzi);
      alert('补货成功');
  }						
 });
}
</script>
<script src="js/outlogin.js"></script>
</html>